﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyMvc.IDAL;
using MyMvc.IBLL;
using MyMvc.Model.Models;
using MyMvc.DAL;
using MyMvc.Model;

namespace MyMvc.BLL
{
    public partial class NoteService : BaseService<Note>, INoteService
    {
        public IQueryable<Note> LoadSearchData(GetModelQuery query)
        {
            //拿到所有数据
            var temp = _dbSession.NoteRepository.LoadEntities(u => true);
            query.total = temp.Count();
            return temp.Skip(query.pageSize * (query.pageIndex - 1)).Take(query.pageSize).AsQueryable();
        }

        public int DeleteNote(List<int> DeleteID)
        {
            foreach (var ID in DeleteID)
            {
                _dbSession.NoteRepository.DeleteEntities(new Note() { ID = ID });
            }
            return _dbSession.SaveChanges();
        }
    }

}
